package com.wzh.controll;

import com.wzh.pojo.Po.Act;
import com.wzh.pojo.Po.Classinfo;
import com.wzh.pojo.Po.Questions;
import com.wzh.pojo.Resp.DataResp;
import com.wzh.service.Actser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/act")
public class act {

	@Autowired
	private Actser actser;

	@PostMapping("/getall")
	public result get(@RequestBody Act act){
		List<Act> list = actser.getall(act);
		String mes=list!=null?"查询成功":"查询失败";
		Integer code=list!=null?200:300;
		return new result(mes,code,list);
	}

	@PostMapping("/add")
	public result addact(@RequestBody Act act){
		System.out.println(act);
		boolean flag=actser.add(act);
		String mes=flag!=false?"操作成功":"操作失败";
		Integer code=flag!=false?200:300;
		return new result(mes,code,act);
	}

	@PostMapping("/delete")
	public result deleteact(@RequestBody Act act){
		System.out.println(act);
		boolean flag=actser.delete(act);
		String mes=flag!=false?"操作成功":"操作失败";
		Integer code=flag!=false?200:300;
		return new result(mes,code,act);
	}

}
